package com.ddm.service.vxService;

import com.baomidou.mybatisplus.extension.service.IService;
import com.ddm.dto.page.PageQueryDTO;
import com.ddm.dto.vxDTO.ExamDTO;
import com.ddm.dto.vxDTO.QuestionAnalysis;
import com.ddm.entity.vxEntity.Exam;
import com.ddm.result.PageResult;
import com.ddm.vo.vxVo.ExamVO;
import com.ddm.vo.vxVo.QuestionVO;

import java.util.List;

/**
 * <p>
 *  服务类
 * </p>
 *
 * @author horizon
 * @since 2025-01-17
 */
public interface ExamService extends IService<Exam> {

    String addExam(ExamDTO examDTO);

    PageResult getExamList(PageQueryDTO pageQueryDTO);

    QuestionVO getNextQuetsion(Long id);

    QuestionVO getPreviousQuestion(Long id);

    void startExam(Long id);

    List<QuestionAnalysis> analysisQuestion(Long id);

    List<ExamVO> getContestInfo();

    /**
     * 根据考试ID查询考试详情（包含问题列表）
     * @param examId 考试ID
     * @return 考试详情
     */
    ExamVO getExamDetail(Long examId);

    /**
     * 获取竞赛统计信息
     * @param examId 竞赛ID
     * @return 统计信息（题目总数、报名人数、参与人数）
     */
    ExamStatistics getExamStatistics(Long examId);

    /**
     * 竞赛统计信息内部类
     */
    class ExamStatistics {
        private Integer questionCount;
        private Integer registeredCount;
        private Integer participatedCount;

        public ExamStatistics(Integer questionCount, Integer registeredCount, Integer participatedCount) {
            this.questionCount = questionCount;
            this.registeredCount = registeredCount;
            this.participatedCount = participatedCount;
        }

        public Integer getQuestionCount() {
            return questionCount;
        }

        public Integer getRegisteredCount() {
            return registeredCount;
        }

        public Integer getParticipatedCount() {
            return participatedCount;
        }
    }

}
